<?php
require_once(dirname(__FILE__).'/inc/header.php');

if ($_GET['flag']==='weibo' or $_GET['flag']==='renren' or $_GET['flag']==='kaixin001' or $_GET['flag']==='qqwb') {		// 检查具体社交账号的登陆情况
	if ($_SESSION['user_id']) {
		$data_user = new data_user();
		$u = $data_user->one($_SESSION['user_id']);
		if ($_GET['flag']		=== 'weibo'	and $u['weibo_id']	and $u['weibo_token']['access_token']) {
			echo 'true';
		} elseif ($_GET['flag']	=== 'renren'	and $u['renren_id']	and $u['renren_token']['access_token']) {
			echo 'true';
		} elseif ($_GET['flag']	=== 'kaixin001'	and $u['kaixin001_id']	and $u['kaixin001_token']['access_token']) {
			echo 'true';
		} elseif ($_GET['flag']	=== 'qqwb'	and $u['qqwb_id']	and $u['qqwb_token']['access_token']) {
			echo 'true';
		}
	}
} elseif ($_GET['flag'] === 'init') {
	if ($_SESSION['user_id']) {
		echo 'true';
	} else {
            $data_login = new data_login();
            $data_login->login_by_cookie();
            if ($_SESSION['user_id']) {
                echo 'true';
            }
        }
} else {
	if ($_SESSION['user_id']) {
		echo 'true';
	}
}

?>
